package com.huyanqi.core;

import java.util.ArrayList;
import java.util.List;

public class PageJson<T>{

	private Integer page;//当前页
	
	private Long total ;//总条数
	
	private List<T> rows = new ArrayList<T>();
	
	public static class Builder<T>{
		private Integer page;
		
		private Long total;
		
		private List<T> rows = new ArrayList<T>();
		
		public Builder(){
			
		}
		
		public Builder(Integer page,Long total,List<T> rows){
			this.page = page;
			this.total = total;
			this.rows = rows;
		}
		
		public Builder<T> page(Integer page){
			this.page = page;
			return this;
		}
		
		public Builder<T> total(Long total){
			this.total = total;
			return this;
		}
		
		public Builder<T> rows(List<T> rows){
			this.rows = rows;
			return this;
		}
		
		public PageJson<T> builder(){
			return new PageJson<T>(this);
		}
	}
	
	public PageJson(Builder<T> builder){
		rows = builder.rows;
		page = builder.page;
		total = builder.total;
	}

	public Integer getPage() {
		return page;
	}	

	public List<T> getRows() {
		return rows;
	}

	public Long getTotal() {
		return total;
	}

}
